Release 10.1A: OpenEdge Data Management:
DataServer for ORACLE


Handling errors

The RUN STORED-PROC statement shows how the RUN STORED–PROC statement supports the NO–ERROR option. Example 3–17 shows how to trap errors within a stored procedure.

DEFINE VAR j AS INTEGER.
RUN STORED-PROC send-sql-statement NO-ERROR
		("select count (*) from xxx.customer where name between ’A’ and ’Z’ ").

IF ERROR-STATUS:ERROR THEN DO:
		DO j = 1 TO ERROR-STATUS:NUM-MESSAGES:
			MESSAGE "error" ERROR-STATUS:GET-NUMBER(j)
					ERROR-STATUS:GET-MESSAGE(j).
		END.
END.

CLOSE STORED-PROC send-sql-statement. 

Example 3–17: How to trap errors within a stored procedure

Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095